
<html><HEAD>
<LINK REL=STYLESHEET HREF="default.css" TYPE="text/css">
<TITLE>
Managing information in initialization files</TITLE>
</HEAD>
<BODY>

<!-- Header -->
<p class="ancestor" align="right"><A HREF="apptechp227.htm">Previous</A>&nbsp;&nbsp;<A HREF="apptechp229.htm" >Next</A>
<!-- End Header -->
<A NAME="X-REF355583769"></A><h1>Managing information in initialization files</h1>
<A NAME="BFCBIGGC"></A><h4>Functions for accessing
initialization files</h4>
<A NAME="TI6394"></A><p>PowerBuilder provides several functions you can use to manage
application settings in initialization files.</p>
<A NAME="TI6395"></A><table cellspacing=0 cellpadding=6 border=1 frame="void" rules="all"><caption>Table 34-1: PowerBuilder initialization file functions</caption>
<tr><th  rowspan="1"  ><A NAME="TI6396"></A>Function</th>
<th  rowspan="1"  ><A NAME="TI6397"></A>Description</th>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI6398"></A>ProfileInt</td>
<td  rowspan="1"  ><A NAME="TI6399"></A>Obtains the integer value of a setting
in a profile file</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI6400"></A>ProfileString</td>
<td  rowspan="1"  ><A NAME="TI6401"></A>Obtains the string value of a setting
in a profile file</td>
</tr>
<tr><td  rowspan="1"  ><A NAME="TI6402"></A>SetProfileString</td>
<td  rowspan="1"  ><A NAME="TI6403"></A>Writes a value in a profile file</td>
</tr>
</table>
<A NAME="TI6404"></A><p>For complete information about these functions,
see the <i>PowerScript Reference</i>
.</p>
<A NAME="TI6405"></A><p>For how to use the <b>ProfileString</b> functions
with the registry, see <A HREF="apptechp229.htm#X-REF355583794">"Managing information
in the Windows registry"</A>.</p>
<A NAME="TI6406"></A><h4>The format of APP.INI</h4>
<A NAME="TI6407"></A><p>The examples below manage application information in a profile
file called <i>APP.INI</i>. This file keeps track
of user preferences that control the appearance of the application.
It has a Preferences section that stores four color settings:<p><PRE> [Preferences]</PRE><PRE> WindowColor=Silver</PRE><PRE> BorderColor=Red</PRE><PRE> BackColor=Black</PRE><PRE> TextColor=White</PRE></p>
<A NAME="TI6408"></A><h4>Reading values </h4>
<A NAME="TI6409"></A><p>The following
script retrieves color settings from the<i> APP.INI</i> file:<p><PRE> wincolor = ProfileString("app.ini", "Preferences", "WindowColor", "")<br>brdcolor = ProfileString("app.ini", "Preferences", "BorderColor", "")<br>bckcolor = ProfileString("app.ini", "Preferences", "BackColor", "")<br>txtcolor = ProfileString("app.ini", "Preferences", "TextColor", "")</PRE></p>
<A NAME="TI6410"></A><h4>Setting values </h4>
<A NAME="TI6411"></A><p>The following
script stores color settings in the <i>APP.INI</i> file:<p><PRE> SetProfileString("app.ini", "Preferences", "WindowColor", wincolor)<br>SetProfileString("app.ini", "Preferences", "BorderColor", brdcolor)<br>SetProfileString("app.ini", "Preferences", "BackColor", bckcolor)<br>SetProfileString("app.ini", "Preferences", "TextColor", txtcolor)</PRE></p>

